package test

import (
	"io"
	"os"

	"google.golang.org/protobuf/encoding/protojson"
	"google.golang.org/protobuf/proto"
)

func OpenJson(path string, message proto.Message) error {
	jsonFile, err := os.Open(path)
	if err != nil {
		return err
	}
	jsonData, err := io.ReadAll(jsonFile)
	if err != nil {
		return err
	}
	return protojson.Unmarshal(jsonData, message)
}
